package sparkcore.day7.lesson08

import org.apache.spark.sql.hive.HiveContext
import org.apache.spark.{SparkConf, SparkContext}

/**
  * Created by Administrator on 2018/5/3.
  */
object UDAFTest {
  def main(args: Array[String]): Unit = {
     val conf = new SparkConf()
    val sc = new SparkContext(conf)
    val sqlContext = new HiveContext(sc)
    sqlContext.udf.register("salary_avg",UDAFDemo)

    sqlContext.sql("select salary_avg(salary) from aura.user").show()
  }

}
